import request from '@/utils/request';

export interface LoginParamsType {
  userName: string;
  password: string;
}

export async function accountLogin({ headers={}, ...params} : {  params: LoginParamsType, headers: any }) {
  return request.post('/login', {
    data: params,
    headers
  });
}

export async function accountLogout() {
  return request.post('/user/logout');
}

export async function sendCaptcha({...params}) {
  return request.get('/commonsafety/findverifcode',{
    params
  });
}

export async function resetPassword({...params}) {
  return request.post('/commonsafety/findpwd',{
    data: params
  });
}

export async function editPassword({headers={}, ...params}) {
  return request.post('/common/account/modifypwd',{
    data: params,
    headers
  });
}

// 登录校验指纹
export async function  loginFingerprintCheck(params:any) {
  return request.get('/login/fingerprintCheck',{
    params
  });
}

// 绑定邮箱 发送验证码
export async function  bindEmailSendCode(params:any) {
  return request.get('/login/bindEmail/sendCode',{
    params
  });
}

// 绑定邮箱 发送验证码
export async function  bindEmailCheck(params:any) {
  return request.get('/login/bindEmail/check',{
    params
  });
}

// 登录校验 - 修改密码
export async function loginForceModifypwd(data:any) {
  return request.post('/login/account/force/modifypwd',{
    data
  });
}